﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;

namespace Lapkin.Models.DataModels
{
    public class Order
    {
        [Key]
        public Guid Id { get; set; }
        public DateTime OrderDate { get; set; }
        public Decimal Total { get; set; }
        public Boolean IsPaid { get; set; }

        public virtual User User { get; set; }
        public virtual OrderStatus OrderStatus { get; set; }
        public virtual ICollection<OrderDetail> OrderDetails { get; set; }

        public virtual Delivery Delivery { get; set; }
        public virtual Payment Payment { get; set; }
    }

    public class OrderStatus
    {
        [Key]
        public Guid Id { get; set; }
        public String Name { get; set; }

        public virtual ICollection<Order> Orders { get; set; }
    }

    public class OrderDetail
    {
        [Key]
        public Guid Id { get; set; }
        public int Quantity { get; set; }
        public Decimal UnitPrice { get; set; }
        
        public virtual Product Product { get; set; }
        public virtual Order Order { get; set; }
        public virtual ICollection<OrderVariant> Variants { get; set; }
    }

    public class OrderVariant
    {
        [Key]
        public Guid Id { get; set; }
        public String Name { get; set; }
        public String Value { get; set; }
        public Decimal Discount { get; set; }

        public OrderDetail OrderDetail { get; set; }
    }
}